@extends('layouts.default')
@section('content')
@include('modules.thanhmenu')
<?php
if(HomeController::checkInTime('dg')){
    

$CanBoDGVaDBL = new CanBoDGVaDBL();
$nhomdk = $CanBoDGVaDBL->getNhomSvDK(Session::get('infor.id_nd')[0]);
?>
<br/>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td>
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tr>
                    <td align="center" colspan="5" class="cm_footer btop brt" style="color:#fff; font-size: 14px; font-weight: bold">
                        Danh Sách Đề Tài Hướng Dẫn
                    </td>
                </tr>
                <tr class="title-danhsachhp" style="color:black; font-size: 14px; font-weight: bold;">
                    <td width="10%" align="center" class="blt bbot" style="padding:5px">
                        STT
                    </td>
                    <td width="10%"align="center" class="blt bbot" style="padding:5px">
                        Mã Nhóm ĐK
                    </td>
                    <td width="40%"align="center" class="blt bbot" style="padding:5px">
                        Tên Đề Tài
                    </td>
                    <td width="20%"align="center" class="blt bbot" style="padding:5px">
                        Nhận Xét
                    </td>
                    <td width="20%" align="center" class="blt brt bbot" style="padding:5px">
                        Cập Nhật Đánh Giá
                    </td>
                </tr> 
                <?php
                $stt=0;
                foreach ($nhomdk as $nhomdks){
                    $trangthai=$CanBoDGVaDBL->getNhanXet($nhomdks->ms_nhom);
               ?>
                <tr <?php if($stt%2!=0) {echo "style='background:#ccc'";}?>>
                    <td class="blt bbot" align="center"  style="padding:5px"><?=++$stt?></td>
                    <input type="hidden" value="<?= $nhomdks->id ?>"/>
                    <td class="blt bbot" align="center"  style="padding:5px"><?=$nhomdks->ms_nhom?></td>
                    <td class="blt bbot" align="center"  style="padding:5px"><?=$nhomdks->ten_de_tai?></td>
                    <td class="blt bbot" align="center"  style="padding:5px"><?php if(count($trangthai)!=0)echo $trangthai->danh_gia;else echo "Chưa Đánh Giá" ; ?></td>
                    <td class="blt brt bbot" align="center" style="padding:5px">
                    <img onclick="location.href='?&&chon=gdg&&id=<?= $nhomdks->id?>&&nhom=<?=$nhomdks->ms_nhom?>'"alt="GhiDanhGia" title="Ghi Danh Gia " class="exampleDiv" src="<?=URL?>public/images/icon_edit.png"/></td>
                </tr>
                <?php 
                }
                ?>
            </table>
        </td>
     </tr>
    <?php if (isset($_REQUEST['chon']))
    {   
        if($_REQUEST['chon']=='gdg')
        {
          $id = $_REQUEST['id'];
          $msnhom=$_REQUEST['nhom'];
    ?>
     <tr>   
        <td class="blt brt bbot">
            <form action="<?=URL?>cb/4/cb_danhgia" method="get" name="frmdg" id="frmdgID">
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tr style='background:#ccc'>
                    <td align="center" class="cm_footer" style="color:#fff; font-size: 14px; font-weight: bold">
                                   Ghi Đánh Giá Nhóm:&nbsp;<?=$msnhom?>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 5px">
                        <textarea cols="87" rows="7" name="txtDanhGia" ></textarea>
                    </td>
                    <input type="hidden" name='txtmsnhom' value="<?=$msnhom?>"/>
                </tr>
                <tr>
                    <td align="center" style="padding: 5px">
                        <input class="exampleDiv cm_footer" style="color:#fff" type="submit" name="luu" value="Lưu Lại"/>&nbsp;
                        <input class="exampleDiv cm_footer" style="color:#fff" type="reset" name="lamlai" value="Làm Lại"/>
                    </td>
                </tr>
            </table>
            </form>
        </td>
    </tr>
    <?php }} 
        if (Session::has('trangthai')) {
                            if (Session::has('trangthai') == 1)
                                echo "<script>alert('Cập Nhật Đánh Giá Thành Công')</script>";
                            else {
                                echo "<script>alert('Cập Nhật Đánh Giá Thất Bại')</script>";
                            }
                        }
    ?>
</table>
<?php
}
else{
    echo "<script>alert('Chưa tới thời gian ghi đánh giá cho sinh viên các nhóm đề tài!');</script>";
}
?>
@stop